package com.hqyj.controller;


import com.hqyj.pojo.SysWarehouse;
import com.hqyj.service.WarehouseService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;
import java.util.HashMap;


@RequestMapping("/warehouse")
@Controller
public class SysWarehouseController {

    @Autowired
    private WarehouseService service;

    //  进货
    @RequestMapping("/warehouseadd")
    public String warehouseadd() {
        return "/warehouse/warehouseadd";
    }

    @RequestMapping("/addAjax")
    @ResponseBody
    public HashMap<String, Object> materialadd(SysWarehouse warehouse) {
        return service.addWareHouse(warehouse);
    }


    // 仓库列表
    @RequestMapping("/warehouselist")
    public String warehouselist() {
        return "/warehouse/warehouselist";
    }

    @RequestMapping("/listAjax")
    @ResponseBody
    public HashMap<String, Object> materiallist(SysWarehouse warehouse) {
        return service.wareHouseList(warehouse);
    }


    //更新库存的数量
    @RequestMapping("/warehouseupdate")
    public String warehouseupdate() {
        return "/warehouse/warehouseupdate";
    }

    @RequestMapping("/updateAjax")
    @ResponseBody
    public HashMap<String, Object> warehouseupdate(SysWarehouse warehouse) {
        return service.wareHouseUpdate(warehouse);
    }

    //退货

    @RequestMapping("/wareHouseReturn")
    public String wareHouseReturn() {
        return "/warehouse/wareHouseReturn";
    }

    @RequestMapping("/returnAjax")
    @ResponseBody
    public HashMap<String, Object> wareHouseReturn(SysWarehouse warehouse) {
        return service.wareHouseReturn(warehouse);
    }


}